<?php
    use User\Model\LiveModel;
?>
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header">
                <present name="live_category">编辑<else/>新建</present>分类
            </h3>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-body">
                    <form role="form" class="form-horizontal" action="/User/Live/updateCategory" method="post" enctype="multipart/form-data" onsubmit="return formcheck();">
                        <input type="hidden" name="id" value="{$id}">
                        <div class="form-group">
                            <label class="col-lg-1 col-sm-2 control-label">分类名称</label>
                            <div class="col-lg-6">
                                <input class="form-control" name="name" title="请输入分类名称" value="{$live_category['name']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 col-sm-2 control-label">排序</label>
                            <div class="col-lg-6">
                                <input class="form-control" name="displayorder" title="请输入分类排序" value="{$live_category['displayorder']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-1 col-sm-2 control-label">状态</label>
                            <div class="col-lg-6">
                                <label class="checkbox-inline">
                                    <input type="radio" name="status" value="<?php echo LiveModel::CATEGORY_INACTIVE ?>" <if condition="$live_category.status eq LiveModel::CATEGORY_INACTIVE or $live_category.status eq null">checked="checked"</if> >禁用
                                </label>
                                <label class="checkbox-inline">
                                    <input type="radio" name="status" value="<?php echo LiveModel::CATEGORY_ACTIVE ?>" <if condition="$live_category.status eq LiveModel::CATEGORY_ACTIVE">checked="checked"</if> >启用
                                </label>
                            </div>
                        </div>
                        <label class="col-lg-1 col-sm-2 control-label"></label>
                        <button type="submit" class="btn btn-primary">提交</button>
                        <button type="button" class="btn btn-default" onclick="history.go(-1)">返回列表</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function formcheck() {
        var ret = true;
        var name = $("input[name=name]").val();
        if(name == ''){
            alert("请输入分类名称");
            ret = false;
            return ret;
        }
        return ret;
    }
</script>